package org.firebug.spring.boot.logback.kafka.controller;

import org.firebug.spring.boot.logback.kafka.bean.User;
import org.firebug.spring.boot.logback.kafka.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/user")
public class UserController {
    private Logger logger = LoggerFactory.getLogger("access");
    @Resource
    private UserService userService;

    @RequestMapping(value = "/query/{id}", method = {RequestMethod.GET})
    public User query(@PathVariable Long id) {
        logger.info("/user/query/{}", id);
        return userService.queryById(id);
    }
}
